Hello Guys, how can i get all Modules in a selected project with chosen "hardcoded" properties like "get module with property 1, 2 and y" ?
meinhana - Wed Jul 22 06:35:57 EDT 2015 |
Re: List all modules and thier properties? ( Have a look to the loop 'for module in folder' and 'ModuleProperties' in the DXL help ... And post your code if you are in trouble ;) ) |
Re: List all modules and thier properties? Hey, i tried this method..
Project targetProject = current Project
Item it
string modname = ""
Module m
Folder f = current
//string descrip = description
for it in targetProject do
{
modname = fullName(it)
print modname "\n"
counter++
for m in f do
{
print count "!"
count++
}
}
but my compiler only show the first print...
"/Test_Project/Specification"
Test_Project is my project name Specification is a folder Test is a formal module
I dont understand why he tells me that there are no modules in my project...
|
Re: List all modules and thier properties? meinhana - Thu Jul 23 02:58:26 EDT 2015 Hey, i tried this method..
Project targetProject = current Project
Item it
string modname = ""
Module m
Folder f = current
//string descrip = description
for it in targetProject do
{
modname = fullName(it)
print modname "\n"
counter++
for m in f do
{
print count "!"
count++
}
}
but my compiler only show the first print...
"/Test_Project/Specification"
Test_Project is my project name Specification is a folder Test is a formal module
I dont understand why he tells me that there are no modules in my project...
Hi !
Perhaps you should explore your project to show its elements ;)
int count_formals(string folder_path, bool verbose){
Folder f = folder folder_path
if ( null f ) return -1
Item it
int count = 0
for it in f do {
if ( isDeleted it ) continue
if ( type(it)=="Link" || type(it)=="Descriptive") continue
if ( verbose ) print rootName_(it) "\n"
if ( type(it)=="Folder" || type(it)=="Project")
count = count + count_formals(fullName it, verbose)
if ( type(it)=="Formal" ) count++
}
return count
}
string path_project = "your project path here"
int nb_modules = count_formals(path_project, false)
if (nb_modules == -1 ) print "No modules in " path_project "\n"
else print nb_modules " detected modules\n"
Enjoy ! |
Re: List all modules and thier properties? Thanks! Very nice |
Re: List all modules and thier properties? Wait what... i dont understand :/ Your answer is very nice, but it dont help me My code gives me all folders and modules but i cant use them, if you know what i mean Your code print "2 detected modules".. And now? I dont know what to do, i only want to print the modules description
Sry but i am very new in dxl coding
|
Re: List all modules and thier properties? meinhana - Thu Jul 23 09:05:56 EDT 2015 Wait what... i dont understand :/ Your answer is very nice, but it dont help me My code gives me all folders and modules but i cant use them, if you know what i mean Your code print "2 detected modules".. And now? I dont know what to do, i only want to print the modules description
Sry but i am very new in dxl coding
( Just have a look to the ModuleProperties feature ... and add what you want to print in the 'if verbose' statement ;) Post your code if you are in trouble ! ) |
Re: List all modules and thier properties? I found this AttrDef ad = find(current Module, "XXX") AttrType at = ad.type print at.name // prints String But it needs a module not an item? Whats the command for an item? |
Re: List all modules and thier properties? meinhana - Fri Jul 24 02:53:26 EDT 2015 I found this AttrDef ad = find(current Module, "XXX") AttrType at = ad.type print at.name // prints String But it needs a module not an item? Whats the command for an item? Hi An Item represents either a module, a folder, a project folder or a link module. You can get access to an Item by different Functions. If you have the Item-ID, you can write Item itmWork = itemFromID("000a0b26"); The Item must not be loaded to get access to it. But if your Item is a module - type(itmWork) will tell it to you - you can open it in the write or read modus. Module mdlWork = edit(fullName(itmWork)); So if you search the database you have to use the items. If you want to read some properties of a module you have to check if your item is a module and then to load the module. Best regards Wolfgang
|
Re: List all modules and thier properties? Wolfgang Uhr - Tue Aug 04 08:23:11 EDT 2015 Hi An Item represents either a module, a folder, a project folder or a link module. You can get access to an Item by different Functions. If you have the Item-ID, you can write Item itmWork = itemFromID("000a0b26"); The Item must not be loaded to get access to it. But if your Item is a module - type(itmWork) will tell it to you - you can open it in the write or read modus. Module mdlWork = edit(fullName(itmWork)); So if you search the database you have to use the items. If you want to read some properties of a module you have to check if your item is a module and then to load the module. Best regards Wolfgang
Ok, how do i get the Item-ID? Is there a method like user.find() ? :/ It's very complicated... I only want to get some properties of a module (and write them into a .txt -file)
|
Re: List all modules and thier properties? meinhana - Tue Aug 04 08:44:25 EDT 2015 Ok, how do i get the Item-ID? Is there a method like user.find() ? :/ It's very complicated... I only want to get some properties of a module (and write them into a .txt -file)
Hi If you use the search script above you have the item. If you have the item, you do not need any ID. If you want to geht the id of an item you can read it yourself - Properties - General - and then the last Digits of "URL:". if you want to find it by dxl you can use uniqueID(itmWork) The best idea for you seems to read the manual one time in one peace. Then you will know where to find such functions. Best regards Wolfgang |
Re: List all modules and thier properties? Thanks... |
Re: List all modules and thier properties?
if ( type(it)=="Formal" )
{
//m = edit(fullName(it))
print name(it)"\n"
m = read(fullName(it), false)
string modulName = m."Name"
string co = "Created On"
Date x = m.co
print x "\n"
count++
}
I found that what i want :) |